package com.jin.controller;

import com.jin.config.MessageConfig.Message;
import com.jin.pojo.WareHouseUserLevel;
import com.jin.service.WareHouseUserLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "仓库信息与用户类型用户信息绑定")
@RestController
@CrossOrigin
public class WareHouseUserLevelController {
    @Autowired
    WareHouseUserLevelService wareHouseUserLevelService;

    @ApiOperation(value = "添加维护关系")
    @PostMapping("/insertWareHouseUserLevel")
    public Message insertWareHouseUserLevel(WareHouseUserLevel wareHouseUserLevel) {
        return wareHouseUserLevelService.insertWareHouseUserLevel(wareHouseUserLevel)>0?Message.success("200").add(wareHouseUserLevel.getWareHouseUserLevelId()):Message.fail("400").add("fail");
    }


    @ApiOperation(value = "删除维护关系")
    @DeleteMapping("/delWareHouseUserLevel")
    public Message delWareHouseUserLevel(Integer warehouseUserLevelId) {
        return wareHouseUserLevelService.delWareHouseUserLevel(warehouseUserLevelId)>0?Message.success("200").add("success"):Message.fail("400").add("fail");
    }


    @ApiOperation(value = "修改维护关系")
    @PutMapping("/updateWareHouseUserLevel")
    public Message updateWareHouseUserLevel(WareHouseUserLevel wareHouseUserLevel) {
        return wareHouseUserLevelService.updateWareHouseUserLevel(wareHouseUserLevel)>0?Message.success("200").add("success"):Message.fail("400").add("fail");
    }
}
